/*
 * Twanoh Library, a useful Android utility library.
 * Copyright (C) 2006 Richard Schilling
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package gnu.org.twanoh.constants;

import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;

/**
 * Constants that are useful to handlers. This standardizes some constant values
 * for common operations. For message {@code MSG_*} constants, the upper two
 * bytes of each constant are used to indicate a constant type. The lower two
 * bytes specify a specific value.
 * 
 * @author Richard Schilling (coderroadie@gmail.com)
 */
public final class HandlerConstants {

    /**
     * Bitmask that is used in constants to indicate a message that refers
     * to a {@link GridView GridView}.
     */
    public static final int MSG_TYPE_GRIDVIEW = 0x00000000;

    /**
     * Bitmask that is used in constants to indicate a message that refers
     * to a {@link ListView ListView}.
     */
    public static final int MSG_TYPE_LISTVIEW = 0x00010000;

    /**
     * Bitmask that is used in constants to indicate a message should cause a
     * {@link Toast} to be displayed.
     */
    public static final int MSG_TYPE_TOAST = 0x00100000;

    /**
     * A message sent to a handler to request that a grid view be refreshed.
     */
    public static final int MSG_GRIDVIEW_REFRESHGRID = MSG_TYPE_GRIDVIEW | 0x0001;

    /**
     * A message sent to a handler to perform the deletion of an item from a
     * grid view. Usually sent to a handler when the
     * {@code MSG_LISTVIEW_CONFIRM_DELETE_ITEM} generates a Cancel/No response
     * from the user.
     */
    public static final int MSG_GRIDVIEW_DO_DELETE_ITEM = MSG_TYPE_GRIDVIEW | 0x0002;

    /**
     * A message sent to a cancel the deletion of an item from a
     * grid view. Usually sent to a handler when the
     * {@code MSG_LISTVIEW_CONFIRM_DELETE_ITEM} generates a Cancel/No response
     * from the user.
     */
    public static final int MSG_GRIDVIEW_DELETE_CANCEL = MSG_TYPE_GRIDVIEW | 0x0003;

    /**
     * A message sent to a handler to ask the user to confirm that an item
     * should be deleted. This usually is processed by a handelr before
     * {@code MSG_LISTVIEW_DO_DELETE_ITEM}.
     */
    public static final int MSG_GRIDVIEW_CONFIRM_DELETE_ITEM = MSG_TYPE_GRIDVIEW | 0x0004;

    /**
     * A message sent to a handler to perform the deletion of an item from a
     * list. Usually sent to a handler when the
     * {@code MSG_LISTVIEW_CONFIRM_DELETE_ITEM} generates a Cancel/No response
     * from the user.
     */
    public static final int MSG_LISTVIEW_DO_DELETE_ITEM = MSG_TYPE_LISTVIEW | 0x0001;

    /**
     * A message sent to a cancel the deletion of an item from a
     * list. Usually sent to a handler when the
     * {@code MSG_LISTVIEW_CONFIRM_DELETE_ITEM} generates a Cancel/No response
     * from the user.
     */
    public static final int MSG_LISTVIEW_DELETE_CANCEL = MSG_TYPE_LISTVIEW | 0x0002;
    /**
     * A message sent to a handler to ask the user to confirm that an item
     * should be deleted. This usually is processed by a handelr before
     * {@code MSG_LISTVIEW_DO_DELETE_ITEM}.
     */
    public static final int MSG_LISTVIEW_CONFIRM_DELETE_ITEM = MSG_TYPE_LISTVIEW | 0x0003;

    /**
     * A message sent to a handler to ask that an item in the list be edited.
     * For example, the handler may show a dialog box for this purpose. The
     * object to be edited might be set in Message.obj.
     */
    public static final int MSG_LISTVIEW_EDIT_ITEM = MSG_TYPE_LISTVIEW | 0x0004;

    /**
     * A message sent to a handler to ask what operation to perform on a list
     * item.
     */
    public static final int MSG_LISTVIEW_CONFIRM_OPERATION = MSG_TYPE_LISTVIEW | 0x0005;

    /**
     * A message sent to a handler to ask that it display an error as a short
     * toast. The error is expected to be a string in Message.obj
     */
    public static final int MSG_TOAST_SHORT_DISPLAY_ERROR = MSG_TYPE_TOAST | 0x0001;

    private HandlerConstants() {}
}
